class Solution {
public: 
    int ret;
    void dfs(vector<int>& nums, int num, int pos)
    {
        ret += num;
        for(int i = pos; i < nums.size(); i++)
        {
            num ^= nums[i];
            dfs(nums, num, i + 1);
            num ^= nums[i];
        }
    }
    int subsetXORSum(vector<int>& nums) {
        dfs(nums, 0, 0);
        return ret;
    }
};